package main

import "fmt"

type Product struct {
	ID    int64   `json:"id"`
	Name  string  `json:"name"`
	Info  string  `json:"info"`
	Price float64 `json:"price"`
}

var products []Product

func initProducts() {
	product1 := Product{ID: 1, Name: "Chicha Morada", Info: "Chicha  level (wiki)", Price: 7.99}
	product2 := Product{ID: 2, Name: "Chicha de jora", Info: "Chicha de sedays (wiki)", Price: 5.95}
	product3 := Product{ID: 3, Name: "Pisco", Info: "Pisco is a emakile (wiki)", Price: 9.95}
	products = append(products, product1, product2, product3)
}

func main() {
	initProducts()
	//如果没有省略号，如下,会提示：
	//Cannot use 'products[i+1:]' (type []Product) as type Product, Inspection info: Reports incompatible types.
	//products = append(products[:i],products[i+1:])
	i := 1
	//正确用法
	products = append(products[:i],products[i+1:]...)

	fmt.Println(products)
}
